package main

import "fmt"

// 定义枚举类
const (
	// iota 每行会累加1，第一行默认值是0
	BEIJING = iota		// iota = 0, BEIJINGJ = 0
	SHANGHAI		// iota = 1, SHANGHAI = 1
	SHENZHEN		// iota = 2, SHENZHEN = 2
)

const (
	a,b = iota + 1, iota + 2	// iota = 0, a = iota + 1, b = iota + 2, a = 1, b = 2
	c,d				// iota = 1, c = iota + 1, d = iota + 2, c = 2, d = 3
	e,f				// iota = 2, e = iota + 1, f = iota + 2, e = 3, f = 4
)

func main(){
	// 常量（只读属性）
	const length = 10
	fmt.Println("length = ",length)
	
	// length = 100 	// 常量是不允许修改的 报错：cannot assign to length
	
	fmt.Println("BEIJING = ",BEIJING)
	fmt.Println("SHANGHAI = ",SHANGHAI)
	fmt.Println("SHENZHEN = ",SHENZHEN)

	fmt.Println("a = ",a,",b = ",b)
	fmt.Println("c = ",c,",d = ",d)
	fmt.Println("e = ",e,",f = ",f)

	// iota 只允许const()使用 报错：undefined: iota
	// var aa = iota
}
